package cn.tarena.ht.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import cn.tarena.ht.pojo.User;

public interface UserMapper {
	
	public List<User> findAll();
	
	public void updateState(@Param("userIds")String[] userIds, @Param("state")int state);

	public void deleteById(String[] userIds);

	public void saveUser(User user);

	public User findUserById(String userId);

	public void updateUser(User user);
	@Insert("insert into role_user_p (role_id,user_id) values (#{roleId},#{userId})")
	public void saveUserRole(@Param("userId") String userId, @Param("roleId")String roleId);
	@Delete("delete from role_user_p where user_id = #{userId}")
	public void deleteUserRole(String userId);
	@Select("select * from role_user_p where user_id = #{userId}")
	public List<String> findUserRoleIdList(String userId);

	public User findUserByUP(@Param("username")String username, @Param("password")String password);

	public User findUserByUsername(String username);

	public List<String> findPrivilegeList(String userId);
}
